<template>
  <div class="Visitorlist">
    <div class="list" v-for="(item, index) in list" :key="index">
      <div class="left" v-if="item.has_one_member">
        <img :src="item.has_one_member.avatar_image" alt="" />
      </div>
      <div class="right">
        <div class="right_left">
          <div class="name" v-if="item.has_one_member">
            {{ item.has_one_member.nickname }}
            <div class="id">ID： {{ item.has_one_member.uid }}</div>
          </div>
          <div class="detail">
            <div class="txt">访问次数：{{ item.top }}</div>
            <div class="detailBtn" @click="toRecord(item.member_id)">查看记录</div>
          </div>
        </div>
        <div class="iconBox" v-if="item.has_one_member">
          <i class="iconfont icon-card_weixin1" v-if="item.has_one_member.wechat && display_set.wechat" v-clipboard:copy="item.has_one_member.wechat" v-clipboard:success="onCopy"></i>
          <i class="iconfont icon-card_phone" @click="telCall(item.has_one_member.mobile)" v-if="item.has_one_member.mobile && display_set.mobile"></i>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    list: {
      type: Array,
      default: []
    },
    display_set: {
      type: null
    }
  },
  data() {
    return {};
  },
  methods: {
    telCall(phone) {
      window.location.href = `tel://${phone}`;
    },
    onCopy() {
      Toast({
        message: "复制成功",
        position: "bottom",
        duration: 1500
      });
    },
    toRecord(uid) {
      this.$router.push(this.fun.getUrl("customerCenterRecord", { id: uid }));
    }
  }
};
</script>
<style lang="scss" scoped>
.Visitorlist {
  margin: 0 0.75rem;
  border-radius: 8px;
  background: #fff;
  padding: 0 0.75rem;

  .list {
    padding: 1.1875rem 0 1.125rem 0;
    border-bottom: 1px solid #e7e7e7;
    display: flex;
    justify-content: space-between;

    .right {
      flex: 1;
      display: flex;
      justify-content: space-between;

      .iconBox {
        display: flex;
        align-items: center;
        justify-content: center;

        .iconfont {
          font-size: 1.3rem;
          color: var(--themeBaseColor);
        }

        .icon-card_weixin1 {
          margin-right: 0.625rem;
        }
      }

      .right_left {
        display: flex;
        flex-direction: column;
        flex: 1;

        .name {
          align-items: center;
          display: flex;
          font-size: 0.8125rem;

          .id {
            font-size: 0.6875rem;
            color: #999;
            margin-left: 0.25rem;
          }
        }

        .detail {
          display: flex;
          align-items: center;
          font-size: 0.75rem;
          color: #02bbff;

          .detailBtn {
            padding: 0.125rem 0.25rem;
            border-radius: 0.75rem;
            color: #fff;
            background: var(--themeBaseColor);
            margin-left: 0.5rem;
          }
        }
      }
    }

    .left {
      flex-shrink: 0;
      width: 2.25rem;
      height: 2.25rem;
      background: rgba(0, 0, 0, 0);
      border-radius: 50%;
      margin-right: 0.5rem;

      img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
      }
    }
  }

  .list:last-child {
    border-bottom: none;
  }
}
</style>